<?php
session_start();
include "../public/common/config.php";
$like = $_GET['like'];
$weibo_id = $_GET['id'];
$user_id = $_SESSION['home_userid'];

$sql = "insert into likes(weibo_id,user_id) values('{$weibo_id}','{$user_id}')";
if($like){
	$sql = "delete from likes where user_id = '{$user_id}' and weibo_id = '{$weibo_id}'";
}
if(mysql_query($sql)){
	echo '<script>location="../index.php"</script>';
}
?>